package com.ymh.spring.advance.config;

import javax.activation.DataSource;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.jndi.JndiObjectFactoryBean;

/**
 * 
 * <h4>项目名称：git_ssm_advance</h4>
 * <h5>名称：ProductionProfileConfig</h5> 
 * <h5>描述：生产环境的配置</h5><br/>
 * <h5>创建时间：2017年11月3日 下午2:43:46</h5> 
 * <h5>版权所有：深圳市启明星电子商务有限公司</h5>
 * @author aivin
 * @version 1.0.0
 */
@Configuration
@Profile(value="prod")
public class ProductionProfileConfig {

	
	@Bean
	public DataSource dataSource(){
		JndiObjectFactoryBean jndiObjectFactoryBean = new JndiObjectFactoryBean();
		jndiObjectFactoryBean.setJndiName("jdbc/myD$");
		jndiObjectFactoryBean.setResourceRef(true);
		jndiObjectFactoryBean.setProxyInterface(DataSource.class);
		
		return (DataSource) jndiObjectFactoryBean.getObject();
	}
}
